<?php
     //引入配置文件
	require '../public/config.php';
	require '../public/mysql.php';
	//开启session
	session_start();
	//获取session中购物车的数据
	@$user= $_SESSION['admin']['user'] ;
	@$carts = $_SESSION['cart'];
	//链接数据库
	$link = connect();
	$sql = "select a.*,a.id aid,w.id wid from address a ,vip w where a.pid =w.id and w.username = '{$user}';";
//	var_dump($sql);
	if ($link['error']) {
		//执行查询的操作
		$address = query($link['mess'], $sql);
	}
//	var_dump($address);
?>
<html>
    <head>
	    <title>订单核对</title>
		<meta charset="utf-8">
		<link type="text/css" rel="stylesheet" href="style/reset.css">
		<link type="text/css" rel="stylesheet" href="style/hd.css">
	</head>

    <body>
	    <div class="headerBar">
		
		<div class="topBar clearfix">
		        <div class="comWidth">
                

				  <div class="logo fl">
				    <a href="#"><img src="./images/logo.jpg" alt="汤浅蓄电池"></a>
				  </div>
					<div class="fr">
					 	<div class="fr">
						<p>
					 
					   
					   <a>购物车</a>
					</p>
					</div>
					<div class="step">
					  <div class="step_1">
					  <div class="center1">
					     <span class="step_1-i2">我的购物车</span>
					     <span class="step_1-i3"></span>
					</div>
					</div>
                    <div class="step_2">
					  <div class="center2">
					     <span class="step_2-i2">填写核对订单</span>
					     <span class="step_2-i3"></span>
					</div>
					</div>
					 <div class="step_3">
					  <div class="center3">
					     <span class="step_3-i2">订单提交成功</span>
		
					</div>
					</div>








				</div>

		</div>
         <div class="kongbai"></div>
<!-- 内容-->
      <div class="mainContent comWidth">
		<div class="list-info-item">
			<h4 class="title">收货信息</h4>
			<form action='./action.php?a=submit' method = 'post'>
			<?php if(!$address==NULL): ?>
			<?php foreach($address as $val): ?>
			<div class="content">
				<label>*<span>选择地区:</span><select name="address" id="select-address">
					<option value="1">苏州市 姑苏区</option>
					<option value="1">苏州市 吴江区</option>
				</select></label>
				<input type="hidden" name="adds" value='<?php echo $val['id'] ?>' checked />
				<label class="detail-add">*<span>详细地址:</span><?php echo $val['addr']?></label>
				<label class="consignee">*<span>收货人:</span><?php echo $val['consignee']?></label>
				<label class="phone-num">*<span>手机:</span><?php echo $val['phone']?>
					
				</label>

				<button class="btn-confirm" ><a href="./address.php?id=<?php echo $val['id']?>">修改收货地址</a></button>
			</div>
			               <?php endforeach; ?>
							<?php else: ?>
							<form action='./action.php?a=submit' method = 'post'>
							<span><a href="./ad.php">添加地址</a></span>
							
							</form>
							<?php endif; ?>
					<button class="btn-confirm" ><input class='' type = 'submit' value = '提交'></button>
							</form>
		</div>
		<div class="list-info-item">
			<h4 class="title">支付方式</h4>
			<div class="content pay">
				<form action="#">
					<label >
						<input type="radio" name="pay" checked ><em>微信支付</em><img src="./images/wx.jpg" alt="微信图标">用微信扫一扫就能支付!
					</label>
					<label >
						<input type="radio" name="pay"><em>货到支付</em>送货上门后再付款,现金或者刷卡,千万别点要收手续费!
					</label>
				</form>

			</div>
		</div>
		<div class="list-info-item">
			<h4 class="title">发票信息</h4>
			<div class="content bill">

				<form action="#">
					<label ><input type="checkbox" checked>需要发票</label>
					<label><em>*</em><span>发票类型:</span><select name="bill" id="select-bill-type">
						<option value="1">商业零售发票</option>
						<option value="2">增值税发票</option>
					</select></label>
					<label><em>*</em><span>发票抬头:</span><select name="bill" id="select-bill-title">
						<option value="1">个人</option>
						<option value="2">单位</option>
					</select>
					<input type="text" placeholder="">
				</label>
				<input type="button" value="保存" name="save"><input type="button" value="取消" name="cancel">
			</form>

		</div>
	</div>
<div class="comWidth">
      <div class="wrap clearfix">
             <h4 class="title">购物车
			 </h4>
          <div class="list_concent">
		     <li class="list_concent1"> 商品名称</li>
		     <li class="list_concent2">单价</li>
		     <li class="list_concent2">数量</li>
		     <li class="list_concent2">小计</li>
		     <li class="list_concent2">操作</li>
		  </div>
		  <?php if(!$carts ==NULL): ?>
          <?php foreach ($carts as $val) :?>
		  <div class="list_next">
		  
		     <li class="list_next1"><img src="<?php echo '../public/upload/'.$val['pic']?>" alt="汤浅蓄电池">
			   <div class="list_next3 fr">
				   </p><?php echo $val['name']?></p>
				   </p class="list_next3">[赠品]美国圣地亚哥公司出品超级水</p>
				  </div>
			 </li>
		     <li class="list_next2">
			 <p><?php echo $val['price']?></p>
             <p>0</p>
			 </li>
		     <li class="list_next2">
             	<a href="javascript:;" class="reduce_num"></a>
						<input type="text" name="amount" value="<?php echo $val['num']?>" class="amount"/>
						<a href="javascript:;" class="add_num"></a>
             </li>
		     <li class="list_next2">
             <p><?php echo $val['count']?></p>
             <p>1</p>
			 </li>
		     <li class="list_next2 list_next4"><a href="./action.php?a=delCart1&id=<?php echo $val['id']?>">删除</a></li>
       
		  </div>
		  <?php @$total += $val['count']?>
		    <?php endforeach;?>
				<?php else: ?>
			 <span>暂无信息</span>
			<?php endif; ?>



<div class="warning-tips">
			<a class="tips" href="#">若对包装有特殊要求，点这里留言</a>
			<p class="warning">抱歉，因为你人长的太帅，所以以下商品不宜购买！</p>
			<div class="warning-info">
				<img src="images/qfz.jpg" alt="清风">
				<div class="des fl">
					<a href="#">清风经济实惠三盒装</a>
					<p>数量：<span class="warning-num">1</span>件</p>
					<p>￥4.90元<span class="reason">(无货)</span></p>
				</div>
			</div>
		</div>
	</div>




	  </div>


	    <div class="list-info-item cl">
		<h4 class="title">订单结算</h4>
		<div class="content confirm-submit">
			<div class="subinfo fr">
			<div class="total">总计<span>￥ <span id="total"><?php echo @number_format($total,2);?></span></strong></div>
				<a href="./flow3.php" ><input type="button" value="提交订单"></a>
			</div>
		</div>

	</div>
      </div>  


    
<!--底部   -->
						 <div class="footer">
                            <p><a href="#">汤浅简介</a><i>|</i><a href="#">招兵买马</a><i>|</i><a href="#">汤浅新闻</a><i>|</i><a href="#">广告与市场合作</a><i>|</i><a href="#">联系我们</a></p>
                            <p>© 2004-2016 beixing.cn Corporation, All Rights Reserved 北星苏州有限公司 版权所有 苏ICP备11004912号</p>
                          
						</div>




























	</body>
</html>